<template>
    <section class="live">
        <section class="freeTitle" style="border-bottom: 0;">
            <span class="liveSpan">直播课程</span>
        </section>
        <section class="liveClass">
            <!-- 左侧内容 -->
            <section class="left">
                <ul id="contents">
                    <li v-for="(item,index) in courseList" :key="item.infoId"
                        v-show='index == indexs'
                        :style="{backgroundImage:`url(${item.course.coverFileUrl})`}">
                        <span class="leftTitle">{{item.course.courseTitle}}</span><br>
                        <span class="myStyle">
                            <img src="../images/选中.png" alt="">
                            {{liveStatus(item.liveStatus)}}
                        </span><br>
                        <button>{{liveStatus(item.liveStatus)}}</button>
                    </li>
                </ul>
            </section>
            <!-- 右侧目录 -->
            <section class="right">
                <ul id="titles">
                    <li v-for="(item,index) in courseList" :key="item.infoId" @mouseenter="one(index)">
                        <a href="detail.html?keyword=&id=${item.courseId}&subjectId=&type=&courseType=">
                            <span class="iconfont icon-xuanzhong1"></span>
                            <span>直播结束</span>
                            <span>{{item.course.courseTitle}}</span>
                        </a>
                    </li>
                </ul>
            </section>
        </section>
    </section>
</template>

<script>
    // $('#titles>li').mouseenter(function () {
    //     $('#contents>li').css('display', 'none').eq($(this).index()).css('display', 'block');
    // })
    export default {
        name: "live",
        data() {
            return {
                courseList: [],
                indexs : 0
            }
        },
        methods: {
            liveStatus(val){
                if (val == 0) {
                    return '未开播'
                } else if (val == 1) {
                    return '正在直播'
                } else if (val == 2) {
                    return '直播结束'
                }
            },
            one(index){
                this.indexs = index;
            }
        },
        created() {
            this.$axios
                .post(
                    "http://wkt.myhope365.com//pc/liveCourseInfo/list"
                ).then((res) => {
                console.log(res.data.rows)
                this.courseList = res.data.rows
            });
        }
    }
</script>

<style scoped>
    /* 直播开始 */
    .freeTitle{
        text-align: center;
    }
    .liveSpan{
        font-size: 24px;
    }
    .liveClass{
        margin: auto;
        margin-top: 20px;
        overflow:hidden;
        width: 1200px;
        height: 350px;
        box-sizing: border-box;
        /* background-color: #00cf8c; */
    }

    /deep/.liveClass>.left{
        float: left;
        width: 600px;
        height: 100%;
        /*opacity: 0.5;*/
        background-color: rgba(0,0,0,0.5)!important;
    }
    /deep/.liveClass>.left>#contents>li{
        background-size: 100% 100%;
        background-color: rgba(0,0,0,0.5);
    }
    .liveClass>.right{
        float: left;
        width: 600px;
        height: 100%;
        box-sizing: border-box;
        border: 1px solid #ccc;
        background-color: #f4f4f4;
    }
    .liveClass>.right>ul>li>a{
        border-left: 4px solid transparent;
        color: black;
        display: block;
        height: 50px;
        line-height: 50px;
    }
    .liveClass>.right>ul>li>a:hover{
        background-color: white;
        color: #00cf8c;
        border-left: 4px solid #00cf8c;
        text-decoration: none;
    }
    .liveClass>.right>ul>li>a:visited{
        text-decoration: none;
    }
    .liveClass>.right>ul>li>a>span:nth-child(1){
        color: #00cf8c!important;
        font-size: 18px;
        padding-left: 36px;
    }
    .liveClass>.right>ul>li>a>span:nth-child(2){
        padding-left: 20px;
    }
    .liveClass>.right>ul>li>a>span:nth-last-child(1){
        font-size: 16px;
        padding-left: 40px;
    }

    #titles>li{
        width: 100%;
        padding: 0;
    }
    #contents {
        width: 100%;
        height: 350px;
    }

    #contents>li {
        width: 100%;
        height: 100%;
        text-align: center;
    }

    .liveClass>.left>ul>li{
        position: relative;
    }

    .leftTitle{
        position: relative;
        top: 100px;
        font-size: 24px;
        color: white;
    }
    .myStyle{
        position: absolute;
        top: 170px;
        left: 266px;
        color: white;
    }

    .liveClass>.left button{
        position: absolute;
        top: 210px;
        left: 210px;
        font-size: 20px;
        font-weight: 500;
        line-height: 50px;
        color: white;
        border-radius: 2px;
        outline: none;
        border: 0;
        background-color: #00cf8c;
        width: 180px;
        height: 50px;
    }
    /* 直播结束 */
</style>